using KinonekoSoftware.Studio.Pages.Galleries.Filters;
using GalleryFilterList = System.Collections.Generic.IEnumerable<KinonekoSoftware.Studio.Pages.Galleries.Filters.GalleryFilter>;

namespace KinonekoSoftware.Studio.Pages.Galleries
{
    public abstract class GalleryScraffolds : TabViewModelCore
    {

        //-------------------------------------------------
        //
        //          ReadOnly Fields 
        //
        //-------------------------------------------------
        internal static readonly IList<GalleryFilter> _Filters = new GalleryFilter[]
        {
            new RecentlyGalleryFilter(),
            new FullyGalleryFilter(),
        };


        //-------------------------------------------------
        //
        //          Fields
        //
        //-------------------------------------------------
        private   InstanceCache            _selected;
        protected InstanceGalleryViewModel2 Core;

        //-------------------------------------------------
        //
        //          Constructors
        //
        //-------------------------------------------------
        protected GalleryScraffolds()
        {
            Collection = new ObservableCollection<InstanceCache>();
        }

        //-------------------------------------------------
        //
        //          Virtual Properties
        //
        //-------------------------------------------------
        internal void ClearParent()
        {
            Core = null;
        }

        internal void SetParent(InstanceGalleryViewModel2 core)
        {
            Core = core;
        }

        //-------------------------------------------------
        //
        //          Virtual Properties
        //
        //-------------------------------------------------
        public virtual GalleryFilterList Filters => _Filters;


        //-------------------------------------------------
        //
        //          Properties
        //
        //-------------------------------------------------
        public InstanceType Type       { get; internal set; }
        public string       CustomType { get; internal set; }

        public InstanceCache Selected
        {
            get => _selected;
            set
            {
                SetValue(ref _selected, value);
                Core?.OnGallerySelectionChanged(value);
            }
        }

        public ObservableCollection<InstanceCache> Collection { get; }
    }
}